﻿using System;
using InterfaceLiftLib.Models.Enums;
using InterfaceLiftLib.Service.Interfaces;

namespace InterfaceLiftLib.Converters.Enums
{
    class SortByConverter : IQueryStringEnumToStringConverter
    {
        public string GetStringValue(object enumValue)
        {
            var val = (SortBy) enumValue;
            switch (val)
            {
                case SortBy.Nothing:
                    return "";
                case SortBy.Date:
                    return "date";
                case SortBy.Id:
                    return "id";
                case SortBy.Favorites:
                    return "favorites";
                case SortBy.Downloads:
                    return "downloads";
                case SortBy.Comments:
                    return "comments";
                default:
                    throw new ArgumentOutOfRangeException("sortEnum");
            }
        }
    }
}
